<?php $this->_extends('_layouts/main_layout'); ?>
<?php $this->_block('title'); ?>
<?php echo isset($pub) ? "Publishers" : "Admins"; ?>
<?php $this->_endblock(); ?>

<?php $this->_block('contents'); ?>
<div id="content" class="box">
	<h1><?php echo isset($pub) ? "Publishers" : "Admins"; ?></h1>
	<div id="menu" class="box">
		<ul class="box">
			<li><a href="<?php  echo isset($pub) ? url('admin/add', array('pub'=>1)) : url('admin/add');?>"><span>Add</span></a></li>
		</ul>
	</div>
		<?php
				if (isset($infos)) 
				{
					foreach ($infos as $info)
					{
		?>
				<p class="msg info"><?php echo $info;?></p>
		<?php		}
				}
		?>
	<table class="full-size">
		<tbody>
			<tr>
				<th>Name</th>
				<th>Email</th>
				<th>Company</th>
				<th>Phone</th>
				<th>Actions</th>
			</tr>
			<?php
				$bg = false;
				if(!empty($admins)):
					foreach ($admins as $admin)
					{
			?>
				<tr <?php if ($bg) echo 'class="bg"';?>>
					<td><?php echo $admin['name'];?></td>
					<td><?php echo $admin['email'];?></td>
					<td><?php echo $admin['company'];?></td>
					<td><?php echo $admin['phone'];?></td>
					<td>
					
					<?php if ($admin['id']>3) {?>
						<?php if(isset($pub)): ?>
							<a href="<?php echo url('admin/edit', array('id'=>$admin['id'], 'pub'=>$pub));?>">Edit</a>
							<a href="<?php echo url('admin/deleteconfirm', array('id'=>$admin['id'], 'pub'=>$pub));?>">Delete</a>
						<?php else:?>
							<a href="<?php echo url('admin/edit', array('id'=>$admin['id']));?>">Edit</a>
							<a href="<?php echo url('admin/deleteconfirm', array('id'=>$admin['id']));?>">Delete</a>
						<?php endif;?>
					<?php } ?>
					</td>
				</tr>
			<?php
						$bg = !$bg;
					}
				endif;
			?>
		</tbody>
	</table>
</div>
<?php $this->_endblock(); ?>
